package com.wolfpire.workflow.om;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 流程实例
 * @author liushx
 *
 */

@Entity
@Table(name = "wf_process_instance")
public class ProInstance implements Serializable{

	private static final long serialVersionUID = -1908598303430804591L;

	@Id
	@Column(name = "INSTANCE_ID", length = 8)
	private Long instanceId;
	
	@Column(name = "WORKFLOW_ID", length = 8)
	private Long workFlowId;
	
	@Column(name = "DEPLOYMENT_ID")
	private Long deploymentId;
	
	@Column(name = "PROC_NAME")
	private String proName;
	
	@Column(name = "NAME_ID")
	private String nameId;//流程名称.ID
	
	@Column(name = "FORM_TYPE_ID")
	private Long formTypeId;
	
	@Column(name = "FORM_ID")
	private Long formId;
	
	@Column(name = "USER_ID")
	private Long userId;
	
	@Column(name = "USER_NAME")
	private String userName;
	
	@Column(name = "ORG_NAME")
	private String orgName;
	
	@Column(name = "CUR_NODE")
	private String curNode;
	
	@Column(name = "CUR_USER")
	private String curUser;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "START_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date startTime;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "END_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date endTime;
	
	@Column(name = "STATUS")
	private String status;//1:正常;2:归档;3:挂起;4:作废

	//----状态分类--   
	@Column(name = "ESTATUSCODE")
	private String estatusCode;
	
	@Column(name = "ESTATUSNAME")
	private String estatusName;
	
	@Column(name = "EVENTOPTYPE")
	private String eventOpType;
	
	@Column(name = "TIME_LIMIT")
	private Long timeLimit;//超时限制
	
	@Column(name = "TIME_LIMIT_STATUS")
	private String timeLimitStatus;//超时限制
	
	@Column(name = "ORG_ID")
	private String orgId;
	
	@Column(name = "PARENT_ID")
	private Long parentId;
	
	@Column(name = "CUR_ORG")
	private String curOrg;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UPDATE_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date updateTime;
	
	@Column(name = "SUB_TASKID")
	private String subTaskId;
	
	@Column(name = "TASK_ID")//子流程对应任务
	private Long taskId;
	
	public ProInstance(Long instanceId, Long workFlowId, Long deploymentId,
			String proName, String nameId, Long formTypeId, Long formId,
			Long userId, String userName, String orgName, String curNode,
			String curUser, Date startTime, Date endTime, String status,
			String estatusCode, String estatusName, String eventOpType,
			Long timeLimit, String timeLimitStatus, String orgId,
			Long parentId, String curOrg, Date updateTime, String subTaskId,
			Long taskId) {
		super();
		this.instanceId = instanceId;
		this.workFlowId = workFlowId;
		this.deploymentId = deploymentId;
		this.proName = proName;
		this.nameId = nameId;
		this.formTypeId = formTypeId;
		this.formId = formId;
		this.userId = userId;
		this.userName = userName;
		this.orgName = orgName;
		this.curNode = curNode;
		this.curUser = curUser;
		this.startTime = startTime;
		this.endTime = endTime;
		this.status = status;
		this.estatusCode = estatusCode;
		this.estatusName = estatusName;
		this.eventOpType = eventOpType;
		this.timeLimit = timeLimit;
		this.timeLimitStatus = timeLimitStatus;
		this.orgId = orgId;
		this.parentId = parentId;
		this.curOrg = curOrg;
		this.updateTime = updateTime;
		this.subTaskId = subTaskId;
		this.taskId = taskId;
	}

	public ProInstance() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Long getDeploymentId() {
		return deploymentId;
	}

	public void setDeploymentId(Long deploymentId) {
		this.deploymentId = deploymentId;
	}

	public Long getFormTypeId() {
		return formTypeId;
	}

	public void setFormTypeId(Long formTypeId) {
		this.formTypeId = formTypeId;
	}

	public Long getFormId() {
		return formId;
	}

	public void setFormId(Long formId) {
		this.formId = formId;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getInstanceId() {
		return instanceId;
	}

	public void setInstanceId(Long instanceId) {
		this.instanceId = instanceId;
	}

	public String getProName() {
		return proName;
	}

	public void setProName(String proName) {
		this.proName = proName;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	public String getCurNode() {
		return curNode;
	}

	public void setCurNode(String curNode) {
		this.curNode = curNode;
	}

	public String getCurUser() {
		return curUser;
	}

	public void setCurUser(String curUser) {
		this.curUser = curUser;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getNameId() {
		return nameId;
	}

	public void setNameId(String nameId) {
		this.nameId = nameId;
	}

	public Long getWorkFlowId() {
		return workFlowId;
	}

	public void setWorkFlowId(Long workFlowId) {
		this.workFlowId = workFlowId;
	}

	public String getEstatusCode() {
		return estatusCode;
	}

	public void setEstatusCode(String estatusCode) {
		this.estatusCode = estatusCode;
	}

	public String getEstatusName() {
		return estatusName;
	}

	public void setEstatusName(String estatusName) {
		this.estatusName = estatusName;
	}

	public String getEventOpType() {
		return eventOpType;
	}

	public void setEventOpType(String eventOpType) {
		this.eventOpType = eventOpType;
	}

	public Long getTimeLimit() {
		if(timeLimit == null) 
			return 10L;
		return timeLimit;
	}

	public void setTimeLimit(Long timeLimit) {
		this.timeLimit = timeLimit;
	}

	public String getTimeLimitStatus() {
		return timeLimitStatus;
	}

	public void setTimeLimitStatus(String timeLimitStatus) {
		this.timeLimitStatus = timeLimitStatus;
	}

	public String getOrgId() {
		return orgId;
	}

	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}

	public String getCurOrg() {
		return curOrg;
	}

	public void setCurOrg(String curOrg) {
		this.curOrg = curOrg;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getSubTaskId() {
		return subTaskId;
	}

	public void setSubTaskId(String subTaskId) {
		this.subTaskId = subTaskId;
	}

	public Long getTaskId() {
		return taskId;
	}

	public void setTaskId(Long taskId) {
		this.taskId = taskId;
	}

}
